
	var indexPage = {
		systemData : null,
		oTable : null,
		resultData : null,
		queryListJson : null,
		isUpdate : false,
		systemId : null,
		isQuery : false,
		ii : 0,

		init : function() {
			var that = this;
			that.createDataTable();
			//添加事件；
			that.initEvent();
			
		},
		initDataSuccess : function(data) {
	 		this.createDataTable();		
		},
		initData : function(e) {
			var that = this;
			var config = {
				url : 'Project/demoListAction.action',
				type : 'GET',
				success : 'indexPage.initDataSuccess'
			};
			doAJax.doConfig(config);
		},
		//创建dataTable
		createDataTable : function() {
			var that = this;
			that.ii = 0;
			if (that.oTable == null) {
			}
			else {
				
				that.oTable.fnClearTable(0);
//				that.oTable.fnDraw(0);
			}
			
			
			//定义数据表格每列的排序情况
			datatableOnServer.aoColumns =[
							{ "sTitle": "#","sClass": "center" ,"bSortable": false},
							{ "sClass": "center" },
							{ "sClass": "center" },
							{ "sClass": "center" },
							{
								   "bSortable": false, "sTitle": "操作","sClass": "center",
								    "fnRender": function (obj) {
								        return '<a href="javascript:indexPage.deleDestina(\'' + obj.aData[4] + '\')" ><font class="datatableOpr2"><i class="icon-edit"></i>删除</font></a>' ;
								    }
								}
                          ];

			//定义默认的排序列
			datatableOnServer.aaSorting = [[1, 'asc']];
			//返回的数据列表
			datatableOnServer.sAjaxDataProp = 'resultList';
			datatableOnServer.fnServerData = that.retrieveData;    //获取数据的处理函数  
			datatableOnServer.sAjaxSource = '/Project/demoListAction.action'; 	//获取数据的url
			datatableOnServer.bFilter = false;
			datatableOnServer.bLengthChange=true;	//改变每页显示数据数量
			//定义序号列位置
			commons.xhId = 3;
			//生成数据表格对象
			that.oTable = $('#dataTableList').dataTable(datatableOnServer);

		},
		retrieveData : function( sSource, aoData, fnCallback ) {
			var that = this;

			var appset = "";
			for ( var i = 0; i < aoData.length; i++) {
				appset = appset + '{"key":"'+aoData[i].name + '","value":"' + aoData[i].value + '"},';
			}
			
			//设置查询参数
			if (indexPage.isQuery) {
				var title = $("#title").val();		
				var content = $("#content").val();		
				appset = appset + '{"key":"title","value":"' + title + '"},'
								+ '{"key":"content","value":"' + content + '"},';
			}
			var apps = appset.substring(0,appset.length-1);
			
			//通过 json的方式,server端,不能获取到数据,将 commons-ajax中的 //contentType : 'application/json',
			var appData = {isQuery:indexPage.isQuery,voList:apps};
//			alert(appData);
			var config = {
					url : sSource,
					type : 'POST',
					data : appData,
					isDT : true,           // 只有在datatable里使用时，才使用此参数
					callFun : fnCallback,  // 只有在datatable里使用时，才使用此参数
					success : 'indexPage.respSuccess'
				};
			doAJax.doConfig(config);
		},
		respSuccess : function(resp) {
//			this.setResultListToLocal(resp);
		},

/*		//删除应用系统事件
		systemsDel : function()
		{
			var that = this;
			var sData = $("#dataTableList :input").serialize();
//        	alert( "delete data: \n\n"+sData );
        	
        	if (sData == null || sData == "") {
        		alert( "请选择要删除的数据！");
        	}
        	else {
        		
//        		var config = {
//					url : commons.webserversite+ '/rest/apps/systems/delete/'+sData,
//					type : 'DELETE',
//					success : 'indexPage.systemsDelSuccess'
//				};
//				doAJax.doConfig(config);
        	}
		},*/
		//添加事件；
		initEvent : function(e){
			var that = this;
			//查询事件
			$("#searchPar").click(function(e){
				indexPage.isQuery = true;				
				indexPage.createDataTable();
			});
		},
		isNull : function(str) {
			if (str == null) {
				str  = "";
			}
			return str;
		},
		
		
		//删除
		deleDestina : function(id){
			art.confirm('你确定要删除记录？', function () {
//			    alert(0);
					var config = {
							url : commons.webserversite+'/noticeDelete.action?id='+id,
							type:'GET',
							success : 'indexPage.delesuc'
					};
				doAJax.doConfig(config);
			}, function () {
//			    alert(1);
				//点击cancel促发这里
			});
		},
		
		//删除成功
		delesuc : function(obj){
			if(obj.isSorF=="success"){
				art.dialog({
				    icon: 'succeed',
				    content: '删除成功！',
				    time:2000
				});
				indexPage.oTable.fnClearTable();	
			}else{
				art.dialog({
				    icon: 'error',
				    content: '该队列主题已被应用占用 ！'
				});
//				alert("该队列主题已被资源占用 ！");
			}
		},
		

	
	
	
	addSuc : function(){
		art.dialog({
		    time: 2,
		    icon:"succeed",
		    lock: true,
		    width:"150px",
	        height:"100px",
		    content: '操作成功!',
		    locked : true
		});
	},
	
	
	
	 	edit_dialog  :null,
		xj:function(){
			var s_content = "";
			s_content = $("#inputnotice").html();
			edit_dialog = art.dialog({
				title:'新建公告',
			    content: s_content,
			    width:'1050px',
			    height:'250px',
			    lock: true
			});
		},
		qx : function(){
			edit_dialog.close();
		},
		//------------------------------
		add : function() {
//			var flag = $("#dataForm").validationEngine('validate');
//			if (!flag) {
//				return false;
//			}
//			if (flag) {
				var config = {
					type : 'POST',
					data : $("#dataForm").serialize(),
					url : commons.webserversite+'/demoAddAction.action',
					success : 'indexPage.addSucInput'
				};
				doAJax.doConfig(config);
//			}
		},
	
	addSucInput : function(obj){
		if (obj.isSorF == "success") {
			//location.href=commons.webserversite+"/mq/showList.action";
			indexPage.oTable.fnClearTable();
			art.dialog({
				title : '提示信息',
				icon : 'succeed',
				content : '添加成功 ！',
				time : 2000
			});
			
			edit_dialog.close();
			
		} else if (obj.isSorF == "error") {
			//alert("未知错误，请重新输入");
			art.dialog({
				title : '提示信息',
				icon : 'succeed',
				content : '未知错误，请重新输入 ！',
				time : 2000
			});
		} 
 }
		//------------------------------
		
	};

	$(document).ready(function(){
		var thats = this;
		indexPage.init();
//		MqCommon.showSubMenu();
	});
	
	
/*	 var closeAllDialog=function(){
	 	alert("aaa");
		var list = art.dialog.list;
		for (var i in list) {
		    list[i].close();
		};
	};*/
	